// 顶升过程
<template>
    <f7-page class="common-page page-tab has-bottom-btns">
      <f7-navbar>
          <f7-nav-left>
              <f7-link back icon-material="chevron_left" force></f7-link>
          </f7-nav-left>
          <f7-nav-title>顶升过程</f7-nav-title>
          <f7-nav-right></f7-nav-right>
      </f7-navbar>
      <div class="common-page-content">
        <van-tabs :lazy-render="false" sticky v-model="activeTab">
          <van-tab name="#tab1" title="安装单位">
            <!-- 安装单位 -->
            <div id="tab1">
              <van-notice-bar v-if="!isInsOrg" color="#FD5050" background="#FFF3F3" left-icon="info-o" wrapable :scrollable="false">
                此模块由安装单位填写，其它用户无需操作
              </van-notice-bar>
              <div class="p15">
                <div class="qzjx-card df-layout aic jcsb">
                  <div class="label">现场照片</div>
                  <div class="value mainColor" @click="gotoScenePhotos">
                    {{controlData.upAttachUploadNum||'0'}} / {{controlData.upAttachAllNum||'0'}}
                    <van-icon name="arrow" />
                  </div>
                </div>
                <div class="qzjx-card df-layout aic jcsb">
                  <div class="label">使用标准节</div>
                  <div class="value mainColor" @click="showProject=true">
                    {{models.sectionList.length}}
                    <van-icon name="arrow" />
                  </div>
                  
                </div>
                <!-- <div class="qzjx-card tab1-check">
                  <div class="top-box df-layout aic jcsb" :class="{hasBorder:checked==false}">
                    <div class="label">本次作业是否全部完成</div>
                    <div class="value mainColor"><van-switch size="20" :disabled="!isInsOrg||!canStop" inactive-color="#F15A5A" v-model="checked" /></div>
                  </div>
                  <template v-if="checked==false">
                    <div class="df-box">
                      <div class="index">1</div>
                      <div class="right-content-box">
                        <div class="title">中止作业时间</div>
                        <van-field
                          readonly
                          clickable
                          name="calendar"
                          :value="stopObj.models.process.stopTime"
                          placeholder="点击选择日期"
                          @click="!isInsOrg||!canStop?'':showCalendar = true"
                          right-icon="arrow"
                        />
                        <van-calendar v-model="showCalendar" @confirm="onConfirm" color="#1990FF"/>
                      </div>
                    </div>
                    <div class="df-box">
                      <div class="index">2</div>
                      <div class="right-content-box">
                        <div class="title">中止原因</div>
                        <ul class="check-box-list">
                          <li 
                            v-for="(item,index) in stopObj.controlData.stopWorkReason" 
                            :key="item.code"
                            :class="{active:item.name==stopObj.models.process.stopReason}"
                            @click="!isInsOrg||!canStop?'':stopObj.models.process.stopReason=item.name"
                          > 
                            {{index+1}}.{{item.name}}
                            <van-icon name="success" v-if="item.name==stopObj.models.process.stopReason"/>
                          </li>
                        </ul>
                      </div>
                    </div>
                    <v-picture-item
                      v-for="(item,index) in list$1"
                      :key="'list$1'+index"
                      :index="index"
                      :props="{ name: 'customName' }"
                      :item="item"
                      :dataKey="stopObj.models.model.caseId"
                      :bizType='item.bizType'
                      listName="stopWork"
                      ref="stopWork"
                      :disabled="!isInsOrg||!canStop"
                      :isDefaultFile="true"
                      :defaultIndex="2"
                      style="margin-top: 15px;"
                      :address="address"
                      :showOffline="list$1Offline==1"
                    />
                  </template>
                </div> -->
              </div>
            </div>
          </van-tab>
          <van-tab name="#tab2" title="施工单位">
            <!-- 施工单位 -->
            <div id="tab2" v-if="models.model&&controlData.property&&controlData.property.equipmentType">
              <van-notice-bar v-if="!isConOrg" color="#FD5050" background="#FFF3F3" left-icon="info-o" wrapable :scrollable="false">
                此模块由施工单位填写，其它用户无需操作
              </van-notice-bar>
              <v-picture-list
                  :props="{ name: 'customName' }"
                  :disabled="!isConOrg||!canEdit"
                  listName="processList"
                  title="管理人员到位情况（现场拍摄）"
                  typeCode="EQM_UP_PROCESS_CONS_PERSON"
                  :dataKey="models.model.caseId"
                  :attachCraneType="controlData.property.equipmentType"
                  @onAfterQuery="(val)=>processList=val"
                  ref="processList"
                  :address="address"
              ></v-picture-list>
              <v-picture-list
                  :props="{ name: 'customName' }"
                  :disabled="!isConOrg||!canEdit"
                  listName="processList1"
                  title="作业过程拍照"
                  typeCode="EQM_UP_PROCESS_CONS_JOB"
                  :dataKey="models.model.caseId"
                  :attachCraneType="controlData.property.equipmentType"
                  @onAfterQuery="(val)=>processList1=val"
                  ref="processList1"
                  :address="address"
              ></v-picture-list>
            </div>
          </van-tab>
          <van-tab name="#tab3" title="监理单位">
            <!-- 监理单位 -->
            <div id="tab3" v-if="models.model&&controlData.property&&controlData.property.equipmentType">
              <van-notice-bar v-if="!isSupOrg" color="#FD5050" background="#FFF3F3" left-icon="info-o" wrapable :scrollable="false">
                此模块由监理单位填写，其它用户无需操作
              </van-notice-bar>
              <v-picture-list
                  :props="{ name: 'customName' }"
                  :disabled="!isSupOrg||!canEdit"
                  listName="list$4"
                  title="旁站监理现场照片"
                  typeCode="EQM_UP_PROCESS_SUPV_PERSON"
                  :dataKey="models.model.caseId"
                  :attachCraneType="controlData.property.equipmentType"
                  @onAfterQuery="(val)=>list$4=val"
                  ref="list$4"
                  :address="address"
              ></v-picture-list>
              <v-picture-list
                  :props="{ name: 'customName' }"
                  :disabled="!isSupOrg||!canEdit"
                  listName="list$5"
                  title="作业过程拍照"
                  typeCode="EQM_UP_PROCESS_SUPV_JOB"
                  :dataKey="models.model.caseId"
                  :attachCraneType="controlData.property.equipmentType"
                  @onAfterQuery="(val)=>list$5=val"
                  ref="list$5"
                  :address="address"
              ></v-picture-list>
              <v-picture-list
                  :props="{ name: 'customName' }"
                  :disabled="!isSupOrg||!canEdit"
                  listName="list$6"
                  title="作业不规范(如涉及)"
                  typeCode="EQM_UP_PROCESS_BEHAVIOR"
                  :dataKey="models.model.caseId"
                  :attachCraneType="controlData.property.equipmentType"
                  @onAfterQuery="(val)=>list$6=val"
                  ref="list$6"
                  :address="address"
              ></v-picture-list>
            </div>
          </van-tab>
          <van-tab name="#tab4" title="监督单位">
            <div id="tab4" v-if="models.model&&controlData.property&&controlData.property.equipmentType">
              <van-notice-bar v-if="!isSupervisor" color="#FD5050" background="#FFF3F3" left-icon="info-o" wrapable :scrollable="false">
                此模块由监督单位填写，其它用户无需操作
              </van-notice-bar>
              <v-picture-list
                  :props="{ name: 'customName' }"
                  :disabled="!isSupervisor||!canEdit"
                  title="旁站监督员现场照片"
                  typeCode="EQM_UP_PROCESS_SUPERVISOR_PERSON"
                  :dataKey="models.model.caseId"
                  :attachCraneType="controlData.property.equipmentType"
                  :address="address"
              ></v-picture-list>
            </div>
          </van-tab>
          <!-- 双确认 -->
          <!-- <van-tab name="#tab4" title="双确认">
            <div id="tab4">
              <van-notice-bar color="#FD5050" background="#FFF3F3" left-icon="info-o" wrapable :scrollable="false">
                此模块由【安装单位专业技术人员，施工单位专职机管员】填写，其它用户无需操作
              </van-notice-bar>
              <div class="p15">
                <template v-if="models.processConfirmList&&models.processConfirmList.length>0">
                  <v-picture-items
                      v-for="(item,index) in models.processConfirmList" 
                      :key="index+'pic'"
                      :index="index"
                      :options="{ name: 'confirmName' }"
                      :item="item"
                      :disabled="true"
                      listName="processConfirmList"
                  >
                    <template slot="content">
                      <li class="upload-li">
                        <span v-if="item.insStatus">{{item.insUserName}}</span>
                        <span v-else class="toSure">{{models.model.pstatus!=7?'待':'未'}}确认</span>
                        <span>安装单位</span>
                        <img v-if="item.insStatus" src="../../../../assets/img/qzjx/sure.png" alt="">
                      </li>
                      <li class="upload-li">
                        <span v-if="item.conStatus">{{item.conUserName}}</span>
                        <span v-else class="toSure">{{models.model.pstatus!=7?'待':'未'}}确认</span>
                        <span>施工单位</span>
                        <img v-if="item.conStatus" src="../../../../assets/img/qzjx/sure.png" alt="">
                      </li>
                    </template>
                    <div v-if="controlData.showConfirmBtn&&models.model.pstatus!=7" slot="btn">
                      <template v-if="isInsOrg">
                        <van-button v-if="!item.insStatus" @click="handleConfirm(item,'1',index)" slot="btn" round type="info" plain>确认符合安全规范</van-button>
                        <van-button v-else @click="handleConfirm(item,'0',index)" slot="btn" round type="danger" plain>取消确认</van-button>
                      </template>
                      <template v-if="isConOrg">
                        <van-button v-if="!item.conStatus" @click="handleConfirm(item,'1',index)" slot="btn" round type="info" plain>确认符合安全规范</van-button>
                        <van-button v-else @click="handleConfirm(item,'0',index)" slot="btn" round type="danger" plain>取消确认</van-button>
                      </template>
                    </div>
                  </v-picture-items>
                </template>
                <v-empty v-else description="暂无双确认事项" />
              </div>
            </div>
          </van-tab> -->
        </van-tabs>
      </div>
      <!-- 中止作业 -->
      <f7-toolbar position="bottom" no-shadow class="fff" v-if="isInsOrg&&!checked&&canStop">
        <f7-button fill class="submit-btn" @click="fnSubmit()">提交</f7-button>
      </f7-toolbar>
      <!-- 顶升过程 -->
      <f7-toolbar position="bottom" no-shadow class="fff" v-if="((isInsOrg&&checked)||(isSupOrg&&!models.process.supvSubmitStatus)||(isConOrg&&!models.process.consSubmitStatus))&&canEdit">
        <f7-button fill class="submit-btn" @click="fnSubmit()">提交</f7-button>
      </f7-toolbar>
      <v-add-list
        v-model="showProject"
        @save="savePart"
        :sendList="models.sectionList"
        :disabled="!isInsOrg||!canEdit"
        :craneType="controlData.property.equipmentType"
      >
      </v-add-list>
    </f7-page>
</template>

<script>
import controller from "@/libs/framework/controller"
import Config from "@/libs/config.js";
import vAddList from "../components/v-add-list.vue";
import vPictureItems from "../components/v-picture-items.vue";
import mixin from "../js/mixin";
export default class instance extends controller {
    onBeforeInit () {
        this.urls = {
            model: "/equipment/eqmUpProcess/getEntity",
            save: "/equipment/eqmUpProcess/save",
        };
    }

    onInit () {}
    onBeforeQuery (type, conditions, params) {}
    onAfterQuery (type, isSuccess, result) {
      if(!result.models.sectionList)result.models=Object.assign(this.context.models,result.models)
      
      // 施工单位自动跳转至当前tab页
      if(result.controlData.isConOrg) this.context.activeTab='#tab2'
      // 监理单位自动跳转至当前tab页
      if(result.controlData.isSupOrg) this.context.activeTab='#tab3'

      // if(result.controlData.isInsOrg&&result.models.model.pstatus==7&&result.controlData.canStop) {
      //   this.context.checked=false
      // }else{
      //   this.context.checked=result.controlData.isAllComplete!=null?result.controlData.isAllComplete:true
      // }
      this.context.checked=result.controlData.isAllComplete
      this.vm.getStopData(result.controlData.stopCaseId)
      return result;
    }
    mixin () {
        return {
          mixins: [mixin],
          components: {
            vAddList,
            vPictureItems,
          },
          data () {
              return {
                activeTab:'#tab1',
                activeStopCode:'',
                stopObj:{
                  models:{
                    process:{

                    }
                  },
                  controlData:{
                    stopWorkReason:[],
                  },
                },
                taskCode:'',
                showProject:false,
                checked:true,
                showCalendar:false,
                list$1:[],
                models: {
                  process:{
                    checkTime:'',
                    isRequire:true,
                    checkMemo:''
                  },
                  sectionList:[]
                },
                controlData:{
                  property:{},
                  workflow:{},
                  engineeBaseInfo:{},
                  maintenanceOrg:{},
                  installOrg:{},
                },
                processList: [],
                processList1: [],
                list$3:[],
                processList2: [],
                list$4:[],
                list$5:[],
                list$6:[],
                address:'',
                list$1Offline:null,
              };
          },
          computed: {
            // 是否安装单位
            isInsOrg(){
              return this.controlData.isInsOrg&&(this.pageAction=='create'||this.pageAction=='edit')
            },
            // 是否施工单位
            isConOrg(){
              return this.controlData.isConOrg&&(this.pageAction=='create'||this.pageAction=='edit')
            },
            // 是否监理单位
            isSupOrg(){
              return this.controlData.isSupOrg&&(this.pageAction=='create'||this.pageAction=='edit')
            },            
            // 是否监督单位
            isSupervisor(){
              return this.controlData.isSupervisor&&(this.pageAction=='create'||this.pageAction=='edit')
            },
            // 是否可以编辑
            canEdit(){
              return this.models.model.pstatus!=7&&this.models.model.pstatus!=999
            },
            // 是否可以中止作业
            canStop(){
              return this.controlData.canStop&&this.models.model.pstatus!=999
            },
          },
          created () {
            this.loadLocation()
          },
          methods: {
            //获取地址
            loadLocation() {
                let self = this
                self.$util.getCurrentPosition(
                    (pos) => {
                        if (pos.addresses) {
                            self.address = pos.addresses
                        }else if(pos.data) {
                            self.address = pos.data.name
                        }
                    },
                    (error) => {
                        // self.$f7.dialog.toast(
                        //     '获取定位失败,请确认是否授权定位功能'
                        // )
                    }
                )
            },
            saveDetects(list){
              let arr=[]
              list.forEach(item=>{
                if(this[item].length>0)arr.push(...this[item])
              })
              let detects=arr.map(item=>{
                return {
                  caseId:this.models.model.caseId,
                  dicId:item.id,
                  isPass:item.isPass,
                  isNil:item.isNil,
                }
              })
              this.$util
              .getPromise("/equipment/eqmCase/saveDetects", {
                detects,
              })
              .then((r) => {
                if(r&&r.success){
                  this.fnSave()
                }else{
                  this.$f7.dialog.alert(r.message || '提交失败');
                }
              }).catch(err=>{
                console.log(err);
              });
            },
            getFileList(typeCode,dataKey,name,attachCraneType){
              this.$f7.request.post(
                '/admin/attachmentFormDetail/listUpload', 
                {typeCode,dataKey,attachCraneType}, 
                (r) => {
                  r = JSON.parse(r);
                  if (r?.success&&r.parameters.fileList) {
                    this[name]=r.parameters.fileList
                    this[`${name}Offline`]=r.parameters.offline
                    return 
                  }
                  this[name]=[]
                  this.$framework.$f7.dialog.toast("获取文件失败");
                }
              );
            },
            gotoScenePhotos(){
              let params={
                disabled:!this.isInsOrg||!this.canEdit,
                formId:this.models.model.caseId,
                equipmentType:this.controlData.property.equipmentType,
                typeCodeList:'EQM_UP_PROCESS_PERSON,EQM_UP_PROCESS_JOB',
                showConfirmBtn:this.controlData.showConfirmBtn&&this.canEdit,
                pstatus:this.models.model.pstatus,
                isConOrg:this.isConOrg,
                isInsOrg:this.isInsOrg,
              }
              let paramStr = [];
              for (let key in params) {
                paramStr.push(`${key}=${params[key]}`);
              }
              paramStr = paramStr.join("&");
              let url=`/business/qzjx/components/vScenePhotos?${paramStr}`
              this.$f7router.navigate(url)
              // this.$f7router.navigate(`/business/qzjx/components/vScenePhotos`,{
              //   props:{
              //     disabled:!this.isInsOrg||this.models.model.pstatus==7,
              //     formId:this.models.model.caseId,
              //     equipmentType:this.controlData.property.equipmentType,
              //     typeCodeList:['EQM_UP_PROCESS_PERSON','EQM_UP_PROCESS_JOB'],
              //     showConfirmBtn:this.controlData.showConfirmBtn&&this.models.model.pstatus!=7,
              //     pstatus:this.models.model.pstatus,
              //     isConOrg:this.isConOrg,
              //     isInsOrg:this.isInsOrg,
              //   }
              // })
            },
            getStopData(stopCaseId){
              if(stopCaseId){
                this.$framework.util
                  .getPromise(`/app/workflow/getWorkflowArgs`, { formId: stopCaseId })
                  .then(res => {
                    if (!res.pageAction || !res.assigneeId) {
                      return;
                    }
                    const params = {
                      pageAction: res.pageAction,
                      caseId: stopCaseId,
                      assigneeId: res.assigneeId,
                      action:res.pageAction=='edit'?'processEdit':'processView',
                    };
                    if (res.pageAction === 'view') {
                      Object.assign(params, { historyTaskId: res.historyTaskId })
                    } else {
                      Object.assign(params, { taskId: res.taskId })
                    }
                    this.getData(params)
                  })
                  .catch(err => {
                    this.$f7.preloader.hide();
                  })
                  .finally(() => {});
              }else{
                let postParams={}
                postParams=this.$f7route.query
                postParams.pageAction='create'
                postParams.action='processStart'
                postParams.notifyId=this.$f7route.query.notifyId
                postParams.appCode='stopWork'
                postParams.caseId=this.$f7route.query.caseId
                this.getData(postParams)
              }
              
            },
            getData(postParams){
              this.$f7.request.post(
                '/equipment/eqmStopWork/workflow/getWorkflowViewModel', 
                {...postParams}, 
                (r) => {
                  r = JSON.parse(r);
                  if (r?.success) {
                    this.stopObj=r
                    if(this.stopObj.models.process.stopTime){
                      this.stopObj.models.process.stopTime=this.$formatter.formatDate(this.stopObj.models.process.stopTime, 'yyyy-MM-dd')
                    }
                    this.getFileList(
                      'EQM_STOP_WORK',
                      this.stopObj.models.model.caseId,
                      'list$1',
                      this.stopObj.controlData.property.equipmentType
                    )
                    return 
                  }
                  this.$framework.$f7.dialog.toast("获取数据失败");
                }
              );
            },
            // 双确认
            handleConfirm(item,type,index){
              this.$f7.dialog.confirm(`确定进行${type==0?'取消':'确认'}操作吗？`, r => {
                if (r) {
                  this.$f7.preloader.show();
                  this.$f7.request.postJSON('/equipment/eqmCase/processConfirm', {confirmId:item.confirmId,type}, (r) => {
                      this.$f7.preloader.hide();
                      if(r.success){
                        r.parameters.processConfirm.fileList=item.fileList
                        this.models.processConfirmList.splice(index,1,r.parameters.processConfirm)
                        this.$forceUpdate()
                      }else{
                        this.$toast(r.message||`${type==0?'取消':'确认'}失败`)
                      }
                  }, (r) => {
                      this.$f7.preloader.hide();
                      
                  });
                }
              });
            },
            savePart(arr){
              this.models.sectionList=arr
              this.save()
            },
            onConfirm(date) {
              this.stopObj.models.process.stopTime = this.$formatter.formatDate(date, 'yyyy-MM-dd');
              this.showCalendar = false;
            },
            // 中止作业的提交按钮
            stopWork(){
              let afterSave =(isSuccess, result, isSend) =>{
                    let msg
                    if (isSuccess) {
                        if (result.parameters && result.parameters.keys) {
                            this.pageAction = "edit";
                            this.models.pageAction = "edit";
                            this.pageActionText = "编辑";
                            this.controlData.workflow.taskId = result.parameters.taskId;
                            this.controlData.workflow.instanceId = result.parameters.instanceId;
                            this.primaryKey = result.parameters.keys;
                        }
                        msg = result.message || '发送成功';
                        if (result.parameters.nextHandlers) {
                            let nestHandler = result.parameters.nextHandlers.join(",");
                            if (nestHandler)
                                msg += "下一环节处理人：<br />" + nestHandler;
                        }
                        this.$f7.dialog.alert(msg, () => {
                                this.$f7.popup.close();
                                this.$f7.views.current.router.back({force:true})
                        });
                    } else {
                        msg = result.message || "发送失败";
                        this.$f7.dialog.alert(msg, () => {
                            
                        });
                    }
                }
                this.$f7.preloader.show();
                this.stopObj.models.workflowComment='中止作业'
                this.stopObj.models.choice = {
                  tran: [],
                  activity: "",
                  users: [],
                };
                this.$f7.request.postJSON(this.stopObj.urls.processRun+'?appCode=stopWork', this.stopObj.models, (r) => {
                    this.$f7.preloader.hide();
                    afterSave(r.success, r, true);
                }, (r) => {
                    this.$f7.preloader.hide();
                    afterSave(false, r, true);
                });
            },
            getConfirmCheck(name){
              let flag=this.models.processConfirmList.every(item=>{
                return item[name]
              })
              return flag
            },
            async getFileFlag(list,ref){
              let func=()=>{
                return new Promise((resolve, reject) => {
                  let num=0
                  this[list].forEach((item,index)=>{
                    if(item.isMustUpload&&this.$refs[ref][index].$refs[`${ref}${index+1}`].getUploadedCount()<1) {
                      num++
                    }
                  })
                  resolve(num)
                })
              }
              let num=await func()
              if(num>0) {
                return false
              }else{
                return true
              }
            },
            async fnSubmit(){
              // 判断是否中止作业
              // 中止作业
              if(!this.checked&&this.canStop){
                if(!this.stopObj.models.process.stopReason) return this.$toast('请勾选中止原因！')
                // 校验中止作业的附件上传完毕没有
                if(!await this.getFileFlag('list$1','stopWork')) return this.$toast('请上传中止作业的相关必传项附件！')
                this.stopWork()
              }else{ // 提交
                // 判断当前单位的类型
                if(this.isInsOrg){ // 安装单位，提交的接口
                // 提示安装单位上传附件的进度
                  let isComplete=await this.getFileComplete('EQM_UP_PROCESS_PERSON,EQM_UP_PROCESS_JOB',this.models.model.caseId,this.controlData.property.equipmentType)
                  if(!isComplete) return 
                  // 判断双确认是否全部已经确认
                  // if(!this.getConfirmCheck('insStatus')) return this.$toast('请确认双确认的内容！');
                  this.$f7.dialog.confirm("请确认【施工、监理】单位已填写完履职内容，提交后将不能修改本次安装过程的内容。", r => {
                    if (r) {
                      this.$f7.request.postJSON('/equipment/eqmUpProcess/submit', {caseId:this.models.model.caseId}, (r) => {
                          this.$f7.preloader.hide();
                          this.$f7.dialog.alert(r.message||'提交成功', () => {
                                this.$f7.views.current.router.back({force:true})
                          });
                      }, (r) => {
                          this.$f7.preloader.hide();
                          this.$f7.dialog.alert(r.message||'提交失败');
                      });
                    }
                  });
                }else{ // 施工单位，监理单位保存接口
                  // 判断施工单位双确认是否全部已经确认
                  if(this.isConOrg){
                    let flag1=this.$refs.processList.getUploadedCount()
                    let flag2=this.$refs.processList1.getUploadedCount()
                    if(!flag1||!flag2)return this.$toast('请上传必传检查项附件')
                    let isComplete=await this.getFileComplete('EQM_UP_PROCESS_CONS_PERSON,EQM_UP_PROCESS_CONS_JOB',this.models.model.caseId,this.controlData.property.equipmentType)
                    if(!isComplete) return 
                    this.saveDetects(['processList','processList1'])
                  }else{
                    let flag3=this.$refs['list$4'].getUploadedCount()
                    let flag4=this.$refs['list$5'].getUploadedCount()
                    let flag5=this.$refs['list$6'].getUploadedCount()
                    if(!flag3||!flag4||!flag5)return this.$toast('请上传必传检查项附件')
                    let isComplete=await this.getFileComplete('EQM_UP_PROCESS_SUPV_PERSON,EQM_UP_PROCESS_SUPV_JOB,EQM_UP_PROCESS_BEHAVIOR',this.models.model.caseId,this.controlData.property.equipmentType)
                    if(!isComplete) return
                    this.saveDetects(['list$4','list$5','list$6'])
                  }
                }
              }
            },
            // 施工单位监理单位的提交方法
            fnSave(){
              this.$util.getPromise("/equipment/eqmCase/zrdwSubmit", {caseId:this.models.model.caseId})
              .then((r) => {
                if(r&&r.success){
                  this.$f7.dialog.alert('提交成功',()=>{
                    this.$f7router.back()
                  });
                }else{
                  this.$f7.dialog.alert(r.message || '提交失败');
                }
              }).catch(err=>{
                console.log(err);
              });
            },
          },
          mounted () {},
        };
    }
}
</script>

<style lang="less" scoped>
@import url('../../../../assets/css/commonPage.less');
.common-page{
  .submit-btn {
      flex: 1;
      margin: 0 10px;
      border-radius: 24px;
  }
  /deep/.van-radio-group{
    display: flex;
    align-items: center;
    .van-radio{
      flex: 1;
      padding: 10px 15px;
      border: 1px solid #D7DCE4;
      border-radius: 20px;
      &:first-child{
        margin-right: 10px;
      }
    }
  }
  .df-box{
    display: flex;
    .index{
      flex-shrink: 0;
      width: 25px;
      height: 22px;
      background: rgba(51, 133, 255, 0.1);
      color: #3385FF;
      margin-right: 15px;
      text-align: center;
      line-height: 22px;
      font-size: 12px;
    }
    .right-content-box{
      flex: 1;
      .title{
        font-weight: 400!important;
      }
    }
  }
  /deep/ .van-field.van-cell{
    background-color: #F5F7FA;
    border: 1px solid #E4E8EB;
    border-radius: 4px;
  }
  /deep/ .van-notice-bar__content{
    font-size: 12px;
    font-weight: 400;
  }
  .qzjx-card{
    .label{
      color: #333333;
    }
    .value /deep/.van-icon{
      color: #B5BCCA;
      margin-left: 10px;
    }
    .van-switch{
      position: relative;
      &::after,&::before{
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        color: #fff;
        font-size: 12px;
      }
      &::after{
        content:'否';
        right: 5px;
      }
      &.van-switch--on{
        &::before{
          content:'是';
          left: 5px;
        }
      }
    }
    &.tab1-check{
      .top-box{
        &.hasBorder{
          padding-bottom: 10px;
          border-bottom: 1px solid #E9EDF7;
        }
        .value{
          display: flex;
          align-items: center;
        }
      }
      .df-box{
        margin-top: 20px;
        .check-box-list{
          li{
            padding: 12px;
            margin-bottom: 5px;
            background: rgba(215, 220, 228, 0.2);
            border-radius: 3px;
            color: #61677A;
            display: flex;
            align-items: center;
            justify-content: space-between;
            &.active{
              color: #1990FF;
              background: rgba(25, 144, 255, 0.1);
            }
            .van-icon{
              color: #1990FF;
            }
          }
        }
      }
    }
  }
  /deep/ .accordion{
    background: #fff;
    margin-top: 10px!important;
  }
  /deep/ .van-icon{
    margin-left: 0!important;
  }
}
</style>
